package com.museum.controller.impl.admin;

import com.alibaba.fastjson.JSONObject;
import com.museum.base.BaseResponse;
import com.museum.controller.api.admin.AdminRoleAPI;
import com.museum.entity.DTO.admin.QueryRole;
import com.museum.entity.DTO.role.RoleAdd;
import com.museum.entity.DTO.role.RoleUpdate;
import com.museum.service.impl.RoleService;
import com.museum.service.impl.admin.AdminRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:
 * @ClassName museum
 * @Author: 王瑞文
 * @Date: 2020/12/28 19:29
 */
@RestController
@RequestMapping("/super/role")
public class AdminRoleController implements AdminRoleAPI {
    @Autowired
    private AdminRoleService adminRoleService;
    @Autowired
    private RoleService roleService;

    @Override
    public BaseResponse<JSONObject> getAllRole(Integer current, Integer limit, QueryRole queryRole) {
        return adminRoleService.getAllRole(current, limit, queryRole);
    }

    @Override
    public BaseResponse<JSONObject> addRole(HttpServletRequest request, RoleAdd roleAdd) {
        return adminRoleService.addRole(roleAdd);
    }

    @Override
    public BaseResponse<JSONObject> deleteRole(Integer roleId) {
        return roleService.deleteRole(roleId);
    }

    @Override
    public BaseResponse<JSONObject> doAssign(RoleUpdate roleUpdate) {
        return roleService.doAssign(roleUpdate);
    }


}
